package 笔试强训;

import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;

public class _0415T3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length(); i++) {
            char cur = s.charAt(i);
            if(stack.isEmpty()) {
                stack.push(cur);
                continue;
            }
            while(!stack.isEmpty()) {
                Character pre = stack.peek();
                if(cur == pre) {
                    stack.pop();
                    if(stack.size()==1) {
                        break;
                    }else {
                        cur = stack.pop();
                    }
                }else {
                    stack.push(cur);
                    break;
                }
            }
        }
        StringBuilder str = new StringBuilder();
        while(!stack.isEmpty()) {
            str.append(stack.pop());
        }
        str.reverse();
        System.out.println(str);
    }
}
